package org.project.single.pojo.constant;

/**
 * 系统缓存名称
 */
public class CacheNameConst {
    /**
     * 字典类型
     */
    public static final String DICT_TYPE_CACHE_DATA = "DICT_TYPE_CACHE_DATA:";

    /**
     * 字典数据
     */
    public static final String DICT_DATA_CACHE_DATA = "DICT_DATA_CACHE_DATA:";


    /**
     * 字典类型修改锁
     */
    public static final String DICT_TYPE_CACHE_LOCK = "DICT_TYPE_CACHE_LOCK:";

    /**
     * 字典数据修改锁
     */
    public static final String DICT_DATA_CACHE_LOCK = "DICT_DATA_CACHE_LOCK:";

    /**
     * 权限角色关系表
     */
    public static final String RBAC_PERMISSION_ROLE_CACHE_DATA = "RBAC_PERMISSION_ROLE_CACHE_DATA:";
    /**
     * 角色缓存
     */
    public static final String RBAC_ROLE_CACHE_DATA = "RBAC_ROLE_CACHE_DATA:";

    /**
     * 角色菜单缓存
     */
    public static final String RBAC_ROLE_MENU_CACHE_DATA = "RBAC_ROLE_MENU_CACHE_DATA:";

    /**
     * 菜单缓存
     */
    public static final String RBAC_MENU_CACHE_DATA = "RBAC_MENU_CACHE_DATA:";



    /**
     * 获取缓存名称
     * @return
     */
    public static String getCacheName(String prefix,String... param){
        StringBuffer sb = new StringBuffer();
        sb.append(prefix);
        for (String s : param) {
            sb.append(s).append(":");
        }
        String key = sb.toString();
        return key.substring(0,key.length()-1);
    }
}
